﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class cn_kfu : System.Web.UI.Page
{
    protected string _cid = "";
    protected string mode = "kfu";
    protected string parentId = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        _cid = Request.QueryString["cid"];
        parentId = Request.QueryString["parentId"];
        if (string.IsNullOrEmpty(_cid))
        {
            _cid = ColumnHelp.GetFirstColumnId(16);
        }
        else
        {
            if (!Whir.Common.WebHelper.Utils.IsInt(_cid))
                _cid = ColumnHelp.GetFirstColumnId(16);
        }

        //Control str2 = null;
        //if (string.IsNullOrEmpty(Request.QueryString["cid"]) )
        //{
        //    str2 = this.LoadControl("common/menu_leftnews2.ascx");
        //}
        //else
        //{
        //    str2 = this.LoadControl("common/menu_leftnews2.ascx");
        //   // str2 = this.LoadControl("common/menu_file.ascx");
        //}
        //Panel2.Controls.Add(str2);


        if (!IsPostBack)
        {
            GetTipsInfo();
            GetList();
        }
    }

    private void GetTipsInfo()
    {
        ltrTips.Text = ColumnHelp.GetColumnName(_cid);
    }

    private void GetList()
    {
        //feedback3=融资
        //if (_cid == "27")
        //{
        //    Response.Redirect(string.Format("feedback3.aspx?cid={0}&parentId={1}", _cid, parentId));
        //}


        //网上申报=feedback4
        if (_cid == "19" || _cid == "23" || _cid == "27" || _cid == "35")
        {
            Response.Redirect(string.Format("feedback4.aspx?cid={0}&parentId={1}", _cid, parentId));
        }
        //在线咨询=feedback
        if (_cid == "31" || _cid == "39" || _cid == "103" || _cid == "105")
        {
            Response.Redirect(string.Format("feedback.aspx?cid={0}&parentId={1}", _cid, parentId));
        }
        string url = string.Format("about.aspx?cid={0}&mode=kfu&parentId={1}", _cid,parentId);
        ColumnHelp.getReader(_cid, url, ColumnHelp.ModuleMarkMode.SinglePage);
        GetDownRead();

        AspNetPager1.PageSize = 10;
        string where = "TypeID=" + _cid;
        where += " and (IsTop='否' or IsTop is null)";
        string countSql = "SELECT COUNT(*) FROM Whir_U_News WHERE " + where;
        AspNetPager1.RecordCount = int.Parse(Whir.SQLServerDAL.DbHelperSQL.GetSingle(countSql).ToString());
        DataTable dt = Whir.SQLServerDAL.DbHelperSQL.GetList("Whir_U_News", "Whir_U_News_PID", "*", AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex - 1, where, "", "CreateDate desc").Tables[0];
        rptList.DataSource = dt;
        rptList.DataBind();


       
    }

    private void GetDownRead()
    {
        Whir.BLL.Whir_Column bll = new Whir.BLL.Whir_Column();
        Whir.Model.Whir_Column model=bll.GetModel(int.Parse(_cid));
        if (model != null)
        {
            if (model.formID == "8")
            {
                Response.Redirect(string.Format("down.aspx?cid={0}&parentId={1}", _cid, parentId));
            }
            if (model.formID == "7")
            {
                Response.Redirect(string.Format("feedback.aspx?cid={0}&parentId={1}", _cid, parentId));
            }
        }
    }

    protected void AspNetPager1_PageChanged1(object sender, EventArgs e)
    {
        GetList();
    }
}
